Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vsock: add buffer space management #316

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

gaojiaqi7
Copy link
Contributor

buf_alloc and fwd_cnt in packet header are used for buffer space management of stream sockets. If peer has insufficient buffer space, the sender waits until new packets are returned and checks buf_alloc and fwd_cnt again.

VIRTIO_VSOCK_OP_CREDIT_REQUEST packet is used to query how much buffer space is available. VIRTIO_VSOCK_OP_CREDIT_UPDATE replies the query and it can also be sent without previous request.

This patch tracks the fwd_cnt and buf_alloc to calculate the free space of peer. The credite request and update packets are also handled.

src/devices/vsock/src/stream.rs Fixed Show fixed Hide fixed
src/devices/vsock/src/stream.rs Fixed Show fixed Hide fixed
`buf_alloc` and `fwd_cnt` in packet header are used for buffer space
management of stream sockets. If peer has insufficient buffer space, the
sender waits until new packets are returned and checks `buf_alloc` and
`fwd_cnt` again.

`VIRTIO_VSOCK_OP_CREDIT_REQUEST` packet is used to query how much buffer
space is available. `VIRTIO_VSOCK_OP_CREDIT_UPDATE` replies the query
and it can also be sent without previous `VIRTIO_VSOCK_OP_CREDIT_REQUEST`.

This patch tracks the `fwd_cnt` and `buf_alloc` to calculate the free
space of peer. The credite request and update packets are also handled.

Signed-off-by: Jiaqi Gao <[email protected]>
@gaojiaqi7 gaojiaqi7 force-pushed the 1030/vsock_buffer_space_management branch from 44d2e87 to 77705fa Compare October 31, 2024 01:55
@jyao1 jyao1 merged commit 97b95be into intel:main Oct 31, 2024
18 checks passed
@jyao1 jyao1 linked an issue Nov 1, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pre-migration(virtio-vsock) will fail with 6.6.0 linux kernel
2 participants